#ifndef __VERTEX_H__
#define __VERTEX_H__

#include <string>
#include <GL/gl.h>

using std::string;

class Vertex
{
public:
	// ctors
	Vertex();
	Vertex(float x, float y, float z, float w = 1.0f);
	Vertex(const Vertex& other);
	
	// dtor
	virtual ~Vertex();
	
	// default operator = with a shallow copy would suffice, but... :)
	Vertex& operator = (const Vertex& other);
	Vertex& operator += (const Vertex& other);
	Vertex& operator -= (const Vertex& other);
	
	Vertex operator + (const Vertex& other) const;
	Vertex operator - (const Vertex& other) const;
	// dot product
	float operator * (const Vertex& other) const;
	// cross product
	Vertex operator ^(const Vertex& other) const;
	
	// setter/getter methods for x, y and z
	float getX() const;
	float getY() const;
	float getZ() const;
	void getXZ(float& x, float& z) const;
	void getAll(float& x, float& y, float& z) const;
	void getAll(float& x, float& y, float& z, float& w) const;
	
	void setX(float x);
	void setY(float y);
	void setZ(float z);
	void setAll(const Vertex& other);
	void setAll(float x, float y, float z);
	
	void draw_v() const;
	void draw_n() const;
	
	Vertex& normalize();
	
	string toString() const;
private:
	float m_x, m_y, m_z, m_w;
};

#endif

